<layout name="master"/>

<form action="" method="post" enctype="multipart/form-data" role="form" class="col-lg-5" style="margin-top: 30px">
    <legend>商城基本配置</legend>
    <?php $sp_system=V('sp_system')?>
    <foreach name="sp_system" item="vo">
        <if condition="$vo['id'] eq 4 ">
            <div class="form-group ">
                <label>{$vo['sname']}</label>
                <input type="file" name="file_upload" id="file_upload1">
                <div id="upload">
                   <li><img width="50px" src="{$vo['svalue']}" alt=""></li>
                    <input type="hidden" name="logo" value="{$vo['svalue']}">
                </div>
            </div>

            <script>
                $(function() {
                    $("#file_upload1").uploadify({
                        height        : 30,
                        'removeTimeout' : 0.2,
                        swf           : '__PUBLIC__/uploadify/uploadify.swf',
                        uploader      : '{:U("logo")}',
                        width         : 120,
                        'buttonText' : '请选择图片',
                        'onUploadSuccess' : function(file, data, response) {
                            str ='<li><img src="'+data+'" alt="" height="50px" >';
                            str+='<a href="javascript:;" class="delimg" path="'+data+'">X<a/>';
                            str+='<input type="hidden" name="logo" value="'+data+'"/>'
                            str+='</li>';
                            $('#upload').append(str);
                        },
                    });
                });
            </script>
            <script>
                $(function(){
                    $('#upload').on('click','.delimg',function(){
                        var path=$(this).attr('path');
                        that =$(this);
                        $.ajax({
                            type: "POST",
                            url: "{:u('delimg')}",
                            data: {path:path},
                            dataType: "json",
                            success: function(msg){
                                if(msg){
                                    that.parent('li').remove();
                                }
                            }
                        });
                    })
                })
            </script>
            <else />
            <div class="form-group ">
                <label>{$vo['sname']}</label>
                <textarea name="svalue[]"  cols="30" rows="2">{$vo['svalue']}</textarea>
            </div>
        </if>

    </foreach>
    <button type="submit" class="btn btn-primary">保存</button>
</form>